let { observable, observe, computed, autorun, when, reaction, action } = require("mobx");

class Person {
    @observable name = "js";
    @observable age = 9;
    @observable list = {
        id: "1",
        name: "2"
    }
    //手机号拼接
    @observable area = "010";
    @observable photo = "15945789456";

    @computed get home() {
        return this.area + "_" + this.photo
    }
    @action.bound chengphoto(area, number) {
        this.area = area;
        this.photo = number;
    }

}
let p1 = new Person();

//监听数据变化，数据当变化时，监听
autorun(() => {
    console.log(p1.home)
})
//p1.chengphoto("45",'html')

//调用别一种写法 ,js 就会报错，解决办法 是， 在 action.bound改成this指针

let o = p1.chengphoto;
o("45", "459785555");


// p1.area = "html";
// p1.photo = 45



let num = 1;
let numObj = observable.box(num);
numObj.observe(x => console.log(x));
numObj.set(100);
num = 2;  //此时不会影响 观察者， 会不会拦截到，答案是不会的。


// let a = 1;
// let b = a;
// b = 3;

